1. Field of the Invention
The present invention relates generally to computer based systems and methods, and more particularly to computer based systems and methods for generating a read-modify-write operation.
2. Related Art
Some computer systems support a read-modify-write (R/M/W) operation. The following operations occur during the processing of a R/M/W operation in a computer system. First, a processor reads data from a memory location of a memory device over a bus. Second, the processor modifies the data in some way. Third, the processor writes the modified data to the memory location of the memory device over the bus.
The read, modify, and write operations which comprise a R/M/W operation are performed atomically. That is, the read, modify, and write operations are performed during a single memory cycle (or during one indivisible acquisition of the memory system) such that, once the R/M/W operation is initiated, it is not possible for any device (other that the processor) to access the data contained in the memory location of the memory device until after the write portion of the R/M/W operation is complete.
As will be appreciated, R/M/W operations are useful for implementing semaphores and various lock operations, such as test and set operations. The classical test and set operation involves reading data from a memory location, modifying the data, writing the modified data to the memory location, and returning the unmodified data to the requestor of the test and set operation. Given this functionality, the manner in which R/M/W operations can be used to implement test and set operations will be apparent to persons skilled in the relevant art. Test and set operations and other locking mechanisms are discussed in a number of publicly available documents, such as Computer Architecture A Quantitative Approach by Hennessy and Patterson (Morgan Kaufmann Publishers, 1990).
In order for a computer system to support read-modify-write operations, the computer system must normally provide an instruction wherein a read operation and a write operation are performed atomically. However, not all computer systems provide such instructions. For example, some processors developed by MIPS Computer Systems, Inc. (Sunnyvale, Cal.) do not support such instructions. In such computer systems, it has been heretofore impossible, to implement R/M/W-based locking operations.
Therefore, what is required is a system and method for implementing read-modify-write operations in computer systems which do not provide a native instruction wherein a read operation and a write operation are performed atomically.